hexadecimal literal
Hexadecimal literals begin with 0x and are followed by 0 to 16 hexadecimal digits (0-9 ,
A-F , a-f). Hexadecimal literals are images of 32-bit or 64-bit integers in 4-bit
chunks.
0 to 8 hex digit literals are typed XLONG, while 9 to 16 hex digit literals are typed
GIANT. Hexadecimal literals with less than 8 hex digits have implicit zeros in the
more significant digit positions, so 0xFEED is equivalent to 0x0000FEED. Therefore,
8 hex digits are required to specify negative numbers. For example, the value -1 is
0xFFFFFFFF, not 0xFFFF (+65535) or 0xFF (+255).
Similarly, 16 hex digits are required to specify negative numbers in the GIANT hexadecimal
format. When 16 hex digits have been collected, the hexadecimal literal is complete
and any further characters, whether hex digits or not, are not counted as being part of
the hexadecimal literal.
0x followed by an invalid hexadecimal character has a value of zero. Type suffixes
are invalid following hexadecimal literals.
octal literal
Octal literals begin with 0o and are followed by 0 to 22 octal digits (0-7) . Octal
literals are images of 32-bit or 64-bit integers in 3-bit chunks.
0 to 11 octal digit literals are typed XLONG, while 12 to 22 octal digit literals are
typed GIANT. The one exception is an 11 octal digit number with the most significant
bit set, which is type GIANT. Octal literals with less than 11 octal digits have
implicit zeros in the more significant digit positions, so 0o7777 is equivalent to
0o00007777. This means that 11 octal digits are required to specify negative
numbers. For example, the value -1 is 0o37777777777 .
Similarly, 22 octal digits are required to specify negative numbers in the GIANT octal
format. When adding another octal digit would cause significant bits to be lost
(shifted out most significant end), further characters, whether valid octal digits or not,
are not counted as being part of the octal literal.
0o followed by an invalid octal character has a value of zero. Type suffixes are
invalid following octal literals.
binary literal
Binary literals begin with 0b and are followed by 0 to 64 binary digits (0-1).
Binary literals are images of 32-bit or 64-bit integers in 1-bit chunks.
0 to 32 binary digit literals are typed XLONG , while 33 to 64 binary digit literals are
typed GIANT. Binary literals with less than 32 significant binary digits have
implicit zeros in the more significant digit positions, so 0b1111 is equivalent to
0b0000000000001111. This means that 32 binary digits are required to specify
negative numbers. For example, -1 is 0b11111111111111111111111111111111 .
Similarly, 64 binary digits are required to specify negative numbers in the GIANT binary
format. When adding another binary digit would cause significant a bit to be lost
(shifted out most significant end), further characters, whether valid binary digits or
not, are not counted as being part of the binary literal.
0b followed by an invalid binary character has a value of zero. Type suffixes are
invalid following binary literals.